
/**
 * @FileName AssertUtil.java
 * @Desciption TODO
 * @author zhouchuanbo
 * @date 2019年9月24日
 */
package com.starinside.wp.utils;

import java.util.Collection;

/**
 * @Description 字符串空和非空判断，列表空和非空判断
 * @FileName AssertUtil.java
 * @author zhouchuanbo
 * @date 2019年9月24日
 */
public class AssertUtil {
    public static boolean isNotEmpty(Collection coll) {
        return !isEmpty(coll);
    }

    public static boolean isEmpty(Collection coll) {
        return (coll == null || coll.isEmpty());
    }

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }

    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }

    public static boolean isEmpty(Object obj) {
        return obj == null || (obj + "").trim().length() == 0;
    }

    public static boolean isNotEmpty(Object obj) {
        return !isEmpty(obj);
    }


    public static boolean isNumeric(String str) {
        try {
            Integer.parseInt(str);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }

}
